#pragma once
#include "pch.h"

struct TcpClient
{
    sockaddr_in clientAddr = {0};
    uint64_t sock;

    template <typename T>
    int Recv(T &t)
    {
        return recv(sock, (char *)&t, sizeof(T), 0);
    }
    int Send(const char *d, int len)
    {
        return send(sock, (const char *)d, len, 0);
    }
    template <typename T>
    int Send(const T &t)
    {
        return send(sock, (const char *)&t, sizeof(T), 0);
    }

    const char *IP() const;

    unsigned int Port() const;
    
    void Close();
};